package fortunata.fswapps.omemo.util;

import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.plugin.PluginException;
import com.ecyrd.jspwiki.plugin.WikiPlugin;
import fortunata.FortunataPlugin;

import java.util.Map;

/**
  * User: Mariano Rico
 * Date: 17-ene-2006
 * Time: 13:43:37
 */

public class AnalyzerRDFStart implements WikiPlugin {
    private static String prefix = null;
    private static String checksWikiPageName = null;
    private static boolean generate = false;

    public String execute (WikiContext Context, Map ParameterMap) throws PluginException {
        String ErrorStringNP = "No parameters given";
        if (ParameterMap == null) {
           return ErrorStringNP;
        }
        prefix             = FortunataPlugin.FormManager.getFieldNoEmplyValue("prefix",   ParameterMap, "prefix");
        checksWikiPageName = FortunataPlugin.FormManager.getFieldNoEmplyValue("checksWikiPageName",   ParameterMap, "checksWikiPageName");
        //if generate was true (assigned by another plugin), it overwrites the value asigned here
        if (generate == false){
            generate = FortunataPlugin.FormManager.getFieldNoEmplyValue("generate", ParameterMap, "generate").equals("yes");
        }

        return "<TABLE width='100%'>" +
                "<TR>"+
                   "<TH><B>File</B></TH>"+
                   "<TH><B>Page (generated)</B></TH>"+
                   "<TH><B>URL (where file comes from)</B></TH>"+
                   "<TH><B>Namespace defined</B></TH>"+
                   "<TH><B>Language</B></TH>"+
                "</TR>";
    }

    public static String getPrefix() {return prefix;}
    public static boolean mustGenerate(){return generate;}
    public static void setGenerate(boolean val){generate = val;}
    public static String getChecksWikiPageName() {return checksWikiPageName;}
}
